package com.UnionPayCenter.account.enums;

import com.UnionPayCenter.enums.CodeBaseEnum;
import com.UnionPayCenter.exception.ApiException;

/**
 * 充值职责枚举，仅仅充值还是充值后要支付
 */
public enum BillDutyEnum implements CodeBaseEnum {

    CHARGE(1, "充值"),
    CHARGE_AND_PAY(2, "充值并支付"),
    PAY(3, "支付"),
    REWARDS(4, "活动优惠金额"),
    IMPORT(5, "用户导入"),
    ;

    private int code;

    private String msg;

    BillDutyEnum(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public static BillDutyEnum getEnum(int code) {
        for (BillDutyEnum ele : BillDutyEnum.values()) {
            if (ele.code == code) {
                return ele;
            }
        }
        throw new ApiException(404, "不正确的充值职责");
    }

    @Override
    public int code() {
        return this.code;
    }

    @Override
    public String msg() {
        return msg;
    }
}
